package com.lzh.gulimall.member.web;

import com.alibaba.fastjson.JSON;
import com.lzh.common.utils.R;
import com.lzh.gulimall.member.feign.OrderFeignService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName MemberWebController
 * @Description TODO
 * @Author liuzhihui
 * @Date 2020/9/9 9:19
 * @Version 1.0
 **/
@Controller
public class MemberWebController {
    @Autowired
    private OrderFeignService orderFeignService;

    @GetMapping("/memberOrder.html")
    public String  memberOrderPage(@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum, Model model){
        Map<String ,Object> page = new HashMap();
        page.put("page",pageNum.toString());

        R r = orderFeignService.listWithItem(page);

        model.addAttribute("orders",r);
        System.out.println(JSON.toJSONString(r));
        //查出当前登录的用户的所有订单列表数据
        return "orderList";
    }

}
